package com.ovt.servlet;
import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.ovt.dao.UserDao;
import com.ovt.dao.impl.UserDaoImpl;

public class addUser extends HttpServlet {
	/**
	 * doPost()方法
	 */
	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		String userName = request.getParameter("userName");
		String password = request.getParameter("password");
		UserDao userDao = new UserDaoImpl();
		boolean flag = userDao.addUser(userName, password);
		if (flag) {
			response.sendRedirect("index.jsp");
		} else {
			response.sendRedirect("error.jsp");
		}
		
	}

}
